import request from '@/utils/request';
// 创建巡查项目试卷
export function createPatrolPaper(data) {
    return request({
        url: '/patrol_item/exam_paper/',
        method: 'post',
        data: data
    })
}


// 查询巡查项目分类
export function queryPatrolType(data) {
    return request({
        url: '/patrol_item_type/',
        method: 'get',
        data: data
    })
}

// 查询巡查项目分类详情
export function queryPatrolTypeInfo(data) {
    return request({
        url: `/patrol_item/?size=${data.size}&page=${data.page}&type=${data.type}`,
        method: 'get',
    })
}

// 创建巡查项目分类 *超级管理员
export function createPatrolType(data) {
    return request({
        url: '/patrol_item_type/',
        method: 'post',
        data: data
    })
}


// 修改巡查项目分类
export function updatePatrolType(data) {
    return request({
        url: `/patrol_item_type/${data.id}/`,
        method: 'put',
        data: data
    })
}

// 删除巡查项目分类
export function delPatrolType(id) {
    return request({
        url: `/patrol_item_type/${id}`,
        method: 'delete',
    })
}


//查看巡查项目试题列表  start_time, end_time筛选时间，格式"%Y-%m-%d %H:%M:%S"  必传
export function patroPaperlList(data) {
    return request({
        url: '/patrol_item/exam_paper/',
        method: 'get',
        data: data
    })
}

//查看巡查项目试卷详情
export function patroPaperlInfo(id) {
    return request({
        url: `/patrol_item/exam_paper/${id}`,
        method: 'get',
    })
}

//查看所有巡查项目试卷
export function patrolList(id) {
    return request({
        url: '/patrol_item/exam_paper/all/',
        method: 'get',
    })
}
// 查询巡查项目分类详情
export function queryPatrolInfo(id) {
    return request({
        url: `/patrol_item_type/${id}/`,
        method: 'get',
    })
}
// 查询项目详情
export function queryProjectInfo(id) {
    return request({
        url: `/patrol_item/${id}/`,
        method: 'get',
    })
}
// 创建巡查项目
export function creatpatrol(data) {
    return request({
        url: '/patrol_item/',
        method: 'post',
        data: data,
    })
}

// 删除巡查项目
export function delpatrol(id) {
    return request({
        url: `/patrol_item/${id}`,
        method: 'delete',
    })
}

// 创建自定义巡查项目
export function customizePatrol(data) {
    return request({
        url: '/patrol_item/create_custom/',
        method: 'post',
        data: data,
    })
}

// 查看巡查项目分类下的巡查项目分页版
export function patrolProject(data) {
    return request({
        url: `/patrol_item/?size=${data.page.pageSize}&page=${data.page.pageNum}&type=${data.type} `,
        method: 'get',
    })
}
// 查看巡查项目分类(包含自定义)
export function getCustomizePatrolType(data) {
    return request({
        url: `/patrol_item_type/list_custom/`,
        method: 'get',
    })
}
// 查看自定义巡查项目分类详情
export function getCustomizePatrolRetrieve(data) {
    return request({
        url: `/patrol_item_type/retrieve_custom/`,
        method: 'get',
    })
}


// 删除自定义巡查项目
export function delCustomizepatrol(id) {
    return request({
        url: `/patrol_item/${id}/destroy_custom/`,
        method: 'delete',
    })
}

// 查看自定义巡查项目分类下的巡查项目分页版
export function getCustomizePatrol(data) {
    return request({
        url: `/patrol_item/list_custom/?size=${data.pageSize}&page=${data.pageNum}`,
        method: 'get',
    })
}